package com.woniuxy.service.impl;

import com.woniuxy.dao.UserDao;
import com.woniuxy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @BelongsProject: java-85-course-code
 * @BelongsPackage: com.woniuxy.service.impl
 * @Author: LiTongMiao
 * @Date: 2022/1/21 12:13
 * @Description: TODO
 */
@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired//通过注解进行自动装配，默认先使用的是bytype进行装配
    UserDao userDao;

    @Override
    public List<Map<String, String>> findAll() {
        Map<String,String> objmap=new HashMap<>();
        objmap.put("account","test");
        userDao.insert(objmap);

        return userDao.findAll();
    }

    @Override
    public void updateOne() {
        Map<Object,Object> objmap=new HashMap<>();
        objmap.put("account","update");
        objmap.put("id","1");
        userDao.updateOne(objmap);
    }
}
